{% extends 'base/base.html' %}

{% block title %}确认删除标签 - {{ project.name }} - 多用户报警系统{% endblock %}

{% block content %}
<div class="row justify-content-center">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header">
                <h2 class="h4">
                    <i class="fa fa-exclamation-triangle" aria-hidden="true"></i> 确认删除标签
                </h2>
            </div>
            <div class="card-body">
                <div class="alert alert-warning" role="alert">
                    <i class="fa fa-exclamation-circle" aria-hidden="true"></i> 警告：删除标签后，所有使用该标签的项目内容将不再显示此标签。
                </div>
                <p class="mb-4">您确定要从项目 <strong>{{ project.name }}</strong> 中删除标签 <span class="tag" style="background-color: {{ tag_to_delete.color }};">{{ tag_to_delete.name }}</span> 吗？</p>
                <div class="mb-4">
                    <div class="p-3 bg-light rounded">
                        <p class="mb-0"><strong>标签名称：</strong>{{ tag_to_delete.name }}</p>
                        <p class="mb-0"><strong>标签颜色：</strong><span class="tag" style="background-color: {{ tag_to_delete.color }};">预览</span></p>
                    </div>
                </div>
                <form method="post">
                    {% csrf_token %}
                    <div class="d-flex gap-2">
                        <button type="submit" class="btn btn-danger">
                            <i class="fa fa-trash" aria-hidden="true"></i> 确认删除
                        </button>
                        <a href="{% url 'projects:project_tags' project.id %}" class="btn btn-secondary">
                            <i class="fa fa-times" aria-hidden="true"></i> 取消
                        </a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}

{% block javascript %}
<script>
    // 添加页面加载动画效果
    document.addEventListener('DOMContentLoaded', function() {
        // 为删除按钮添加确认提示
        const deleteButton = document.querySelector('.btn-danger');
        if (deleteButton) {
            deleteButton.addEventListener('click', function(e) {
                if (!confirm('确定要删除标签 "{{ tag_to_delete.name }}" 吗？')) {
                    e.preventDefault();
                }
            });
        }
    });
</script>
{% endblock %}